TOPE = 999

def isPal(n):
	s = str(n)
	for x in range(0, (len(s)+1)/2):
		if s[x] != s[-(x+1)]:
			return False
	return True

def largestPal():
	for a in range(TOPE, TOPE-100, -1):
		for b in range(TOPE, TOPE-100, -1):
			if isPal(a*b):
				return a*b

if __name__ == "__main__":
	print "\n", largestPal(), "\n"
